package com.yanqu.road.server.timer.rankunionwar;

import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.manger.activity.rankunionwar.RankUnionWarMgr;
import com.yanqu.road.utils.executor.GeneralTask;


public class RankUnionWarTimerTask extends GeneralTask {

    private boolean isRun = false;

    @Override
    public void doRun() {
        if(!isRun) {
            isRun = true;

            // 3秒一次
            long param = 3;
            long secondIndex = System.currentTimeMillis() / 1000 % param;
            long canSendIndex = GameServer.getInstance().getServerId() % param;
            if (secondIndex == canSendIndex) {
                try {
                    RankUnionWarMgr.timerTask();
                }catch (Exception e){
                    getLOGGER().error("RankUnionWarTimerTask error:",e);
                }
            }
            isRun = false;
        }
    }
}
